//
//  HomeCollectionViewCell.m
//  ProfilePicture
//
//  Created by 张云江 on 2019/10/14.
//  Copyright © 2019年 张云江. All rights reserved.
//

#import "HomeCollectionViewCell.h"

@interface HomeCollectionViewCell()

@property(nonatomic,strong)UIView  *litile;
@property(nonatomic,strong)UILabel *nameLab;
@property(nonatomic,strong)UILabel *sizeLab;

@end

@implementation HomeCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatUI];
    }
    return self;
}

- (void)creatUI
{
    self.backgroundColor = [UIColor whiteColor];
    self.layer.cornerRadius = kRatio(20);
    self.layer.masksToBounds = kRatio(20);
    
    self.litile = [[UIView alloc] initWithFrame:CGRectMake(kRatio(16), kRatio(16), kRatio(12), kRatio(12))];
    self.litile.layer.cornerRadius = 6;
    self.litile.layer.masksToBounds = YES;
    self.litile.layer.borderWidth = kRatio(3);
    self.litile.layer.borderColor = kUIColorFromRGB(0xd5ddfb).CGColor;
    self.litile.backgroundColor = kUIColorFromRGB(0x2F54EB);
    [self addSubview:self.litile];
    
    self.nameLab = [[UILabel alloc]init];
    self.nameLab.text = @"一寸";
    self.nameLab.numberOfLines = 3;
    self.nameLab.font = [UIFont systemFontOfSize:kRatio(16) weight:100];
    self.nameLab.textColor = kUIColorFromRGB(0x000000);
    [self addSubview:self.nameLab];
    [self.nameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(kRatio(16));
        make.right.equalTo(self).offset(kRatio(-16));
        make.top.equalTo(self.mas_top).offset(kRatio(50));
    }];
    
    self.sizeLab = [[UILabel alloc]init];
    self.sizeLab.text = @"295 x 413 px";
    self.sizeLab.numberOfLines = 3;
    self.sizeLab.font = [UIFont systemFontOfSize:kRatio(14)];
    self.sizeLab.textColor = kUIColorFromRGA(0x000000, 0.45);
    [self addSubview:self.sizeLab];
    [self.sizeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(kRatio(16));
        make.right.equalTo(self).offset(kRatio(-16));
        make.top.equalTo(self.nameLab.mas_bottom).offset(kRatio(8));
    }];
}

- (void)updateInfo:(HomeInfoMode *)info
{
    self.nameLab.text = info.name;
    self.sizeLab.text = info.sizeDes;
}
@end
